import { createDecorator } from 'vue-class-component'
import * as _ from 'lodash'
/**
 * Debounce装饰器
 * author HYH
 */
export const Debounce = createDecorator((options: any, key) => {

    const originalMethod = options.methods[key];
    options.methods[key] = function wrapperMethod(...args: []) {
        const func = _.debounce(() => {
            originalMethod.apply(this, args)
        }, 3000)
        func()
    };
});